<?php
namespace app\admin\controller;
use think\Controller;
use think\Session;
class Action extends Controller
{
    public function _initialize()

    {
    	header("Content-type: text/html; charset=utf-8");
        $this->getType();        
        if(!session('UserName') && !session('UserId')) {
            echo "<script>alert('请先登录系统！');window.location.href='/admin/login/login';</script>";
            exit;
        }
        //验证权限
        model("Admin")->checkAuth();   

    }

    private function getType(){
        $typeRes = model("Type")->getType();
        $this->assign([
            "typesRes" => $typeRes,
        ]);
    }


}
